realtek: cleanup debugfs creation in serdes driver
authorMarkus Stockhausen <[email protected]>
Sun, 14 Dec 2025 09:03:47 +0000 (10:03 +0100)
committerRobert Marko <[email protected]>
Mon, 15 Dec 2025 08:29:17 +0000 (09:29 +0100)
debugfs_create_dir() has a proper logic to handle existing directories.
Skip the manual test. Additionally quit early if directory creation fails.

Signed-off-by: Markus Stockhausen <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/21157
Signed-off-by: Robert Marko <[email protected]>
target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto-serdes.c

index 2bd38f382d69bbc6e8e0f916452a95cb562253ec..394af71250b42c95c631c53a51842e65f0213fbf 100644 (file)
@@ -155,9 +155,9 @@ static int rtsds_debug_init(struct rtsds_ctrl *ctrl, u32 sds)
        dbg_info->ctrl = ctrl;
        dbg_info->sds = sds;
 
-       root = debugfs_lookup(RTSDS_DBG_ROOT_DIR, NULL);
-       if (!root)
-               root = debugfs_create_dir(RTSDS_DBG_ROOT_DIR, NULL);
+       root = debugfs_create_dir(RTSDS_DBG_ROOT_DIR, NULL);
+       if (IS_ERR(root))
+               return PTR_ERR(root);
 
        snprintf(dirname, sizeof(dirname), "serdes.%d", sds);
        dir = debugfs_create_dir(dirname, root);